<?php defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * Example
 *
 * This is message API to send email message.
 *
 * @package		API
 * @subpackage	
 * @category	Controller
 * @author		Pwint PHyu Shwe
 * @link		
*/

// This can be removed if you use __autoload() in config.php OR use Modular Extensions
require APPPATH.'/libraries/REST_Controller.php';

class Message extends REST_Controller
{
    
    function send_post()
    {
        $message = 'Name: ' . $this->post('name') . '   ' . 'Email: ' . $this->post('email') . '  '. '< Message: ' . $this->post('message') . '';

        $messageParam['to'] =  $this->post('email');
        $messageParam['from'] = $this->config->item('email');
        $messageParam['subject'] = '[Maykhaclassifieds.com]: Product Enquiry';
        $messageParam['messagebody'] = $message;
        $messageParam['replyTo'] = 'pwintphyushwe@gmail.com';
        $messageParam['url'] = 'www.maykhaclassifieds.com';


        $this->load->helper('aws_email');
        send_email_via_aws($messageParam);
        //$message = array('id' => $this->get('id'), 'name' => $this->post('name'), 'email' => $this->post('email'), 'message' => 'ADDED!');
        
        $this->response('Sent Successfully', 200); // 200 being the HTTP response code
    }
    function broadcast_post()
    {

    }
    
  
}